<?php

/**
 * Main configuration.
 * All properties can be overridden in mode_<mode>.php files
 */

$urlManager = array(
	'urlFormat'=>'path',
	'showScriptName'=>false,
	'urlSuffix'=>'.html',
	'rules'=>array(
		'<module>/api/<controller:\w+>'=>array(
			'<module>/<controller>/restList',
			'verb'=>'GET'
		),
		'<module>/api/<controller:\w+>/<id:\w+>'=>array(
			'<module>/<controller>/restView',
			'verb'=>'GET'
		),
		'<module>/api/<controller:\w+>/<id:\w+>/<var:\w+>'=>array(
			'<module>/<controller>/restView',
			'verb'=>'GET'
		),
		array(
			'<module>/<controller>/restUpdate',
			'pattern'=>'<module>/api/<controller:\w+>/<id:\d+>',
			'verb'=>'PUT'
		),
		array(
			'<module>/<controller>/restUpdate',
			'pattern'=>'<module>/api/<controller:\w+>/<var:\w+>/<id:\d+>',
			'verb'=>'PUT'
		),
		array(
			'<module>/<controller>/restDelete',
			'pattern'=>'<module>/api/<controller:\w+>/<id:\d+>',
			'verb'=>'DELETE'
		),
		array(
			'<module>/<controller>/restCreate',
			'pattern'=>'<module>/api/<controller:\w+>',
			'verb'=>'POST'
		),
		array(
			'<module>/<controller>/restCreate',
			'pattern'=>'<module>/api/<controller:\w+>/<id:\w+>',
			'verb'=>'POST'
		),
		'api/<controller:\w+>'=>array(
			'<controller>/restList',
			'verb'=>'GET'
		),
		'api/<controller:\w+>/<id:\w+>'=>array(
			'<controller>/restView',
			'verb'=>'GET'
		),
		'api/<controller:\w+>/<id:\w+>/<var:\w+>'=>array(
			'<controller>/restView',
			'verb'=>'GET'
		),
		array(
			'<controller>/restUpdate',
			'pattern'=>'api/<controller:\w+>/<id:\d+>',
			'verb'=>'PUT'
		),
		array(
			'<controller>/restUpdate',
			'pattern'=>'api/<controller:\w+>/<var:\w+>/<id:\d+>',
			'verb'=>'PUT'
		),
		array(
			'<controller>/restDelete',
			'pattern'=>'api/<controller:\w+>/<id:\d+>',
			'verb'=>'DELETE'
		),
		array(
			'<controller>/restCreate',
			'pattern'=>'api/<controller:\w+>',
			'verb'=>'POST'
		),
		array(
			'<controller>/restCreate',
			'pattern'=>'api/<controller:\w+>/<id:\w+>',
			'verb'=>'POST'
		),
		'<controller:\w+>/<id:\d+>'=>'<controller>/view',
		'<controller:\w+>/<action:\w+>/<id:\d+>'=>
		'<controller>/<action>',
		'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
	),
);

$less = array(
	'class'=>'Less',
	'touchPaths'=>array(
		'assets',
	),
	'paths'=>array(
		"assets/less/typography.less"=>"assets/css/typography.css",
		"assets/less/form.less"=>"assets/css/form.css",
		
		"assets/classic/less/main.less"=>"assets/classic/css/main.css",
		"assets/classic/less/print.less"=>"assets/classic/css/print.css",
		"assets/classic/less/form.less"=>"assets/classic/css/form.css",
	),
);

return array(
	// Set yiiPath (relative to Environment.php)
	'yiiPath'=>dirname(__FILE__) . '/../../../yii/framework/yii.php',
	'yiicPath'=>dirname(__FILE__) . '/../../../yii/framework/yiic.php',
	'yiitPath'=>dirname(__FILE__) . '/../../../yii/framework/yiit.php',
	// Set YII_DEBUG and YII_TRACE_LEVEL flags
	'yiiDebug'=>true,
	'yiiTraceLevel'=>0,
	// Static function Yii::setPathOfAlias()
	'yiiSetPathOfAlias'=>array(
	// uncomment the following to define a path alias
	//'local' => 'path/to/local-folder'
	),
	// This is the main Web application configuration. Any writable
	// CWebApplication properties can be configured here.
	'configWeb'=>array(
		'basePath'=>dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
		'name'=>'WLMS Sinar Mas Palembang',
		'preload'=>array(
			'log',
			'less',
			'kint',
			'bootstrap',
		),
		'theme'=>'classic',
//		'catchAllRequest'=>array(
//			'site/page',
//			'view'=>'offline',
//		),
		'defaultController'=>'site',
		'homeUrl'=>array('/site/index'),
		// Autoloading model and component classes
		'import'=>array(
			'application.behaviors.*',
			'application.components.*',
			'application.forms.*',
			'application.models.*',
			'ext.*',
			'ext.restfullyii.components.*',
			'application.widgets.*',
		),
		// Application components
		'components'=>array(
			'user'=>array(
				'allowAutoLogin'=>true,
			),
			'urlManager'=>$urlManager,
			'errorHandler'=>array(
				// use 'site/error' action to display errors
				'errorAction'=>'site/error',
			),
			'format'=>array(
				'class'=>'Formatter',
				'dateFormat'=>'l, F j, Y',
				'datetimeFormat'=>'l, F j, Y h:i A',
				// Or you can define everywhere in the view:
				// Yii::app()->format->dateFormat = 'l, F j, Y';
				'numberFormat'=>array(
					'decimalSeparator'=>',',
					'thousandSeparator'=>'.',
					'decimals'=>0,
				),
			),
			'less'=>$less,
			'kint'=>array(
				'class'=>'ext.Kint.Kint',
			),
			'bootstrap'=>array(
				'class'=>'ext.bootstrap.components.Bootstrap',
				'responsiveCss'=>true,
			),
		),
		'behaviors'=>array(
			'layout'=>'application.behaviors.LayoutBehavior',
		),
		// application-level parameters that can be accessed
		// using Yii::app()->params['paramName']
		'params'=>array(
			// this is used in contact page
			'adminEmail'=>'andy.julot@gmail.com',
		),
	),
	// This is the Console application configuration. Any writable
	// CConsoleApplication properties can be configured here.
	// Leave array empty if not used.
	// Use value 'inherit' to copy from generated configWeb.
	'configConsole'=>array(
		'basePath'=>dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
		'name'=>'Infinite Stratos: Cecilia',
		// Preloading 'log' component
		'preload'=>array('log'),
		// Autoloading model and component classes
		'import'=>'inherit',
		// Application componentshome
		'components'=>array(
			// Database
			'db'=>'inherit',
			'user'=>array(
				'class'=>'ConsoleUser',
			),
			// Application Log
			'log'=>array(
				'class'=>'CLogRouter',
				'routes'=>array(
					// Save log messages on file
					array(
						'class'=>'CFileLogRoute',
						'levels'=>'error, warning, trace, info',
					),
				),
			),
		),
	),
);